<!DOCTYPE html>
<html>
<head>
    <title>Stirng</title>
    <meta charset="utf-8"/>
    <script>
      var s1 = "11111,2,";
        alert(s1.length);
        alert(s1.substring(0, s1.length - 1));

    </script>
</head>
<body>

</body>
</html>